package com.rt.generalframework.web;

import com.rt.generalframework.api.DictUserFeignClient;
import com.rt.generalframework.dto.DictUsersDto;
import com.rt.generalframework.entity.DictUsers;
import com.rt.global.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * TODO().
 *
 * <p>TODO().
 *
 * <p>版权所有:Copyright (c) 2019<br/>
 * <a href="http://www.wiseimage.cn/">广州易联众睿图信息技术有限公司</a>.
 *
 * @author 周昭名
 * @version V1.0
 * @since 2019/11/1 12:48
 */
@RestController
public class TestController {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private DictUserFeignClient dictUserFeignClient;

    @RequestMapping("test")
    public String test(){
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_JSON);
        HttpEntity<String> entity = new HttpEntity<>("{}", headers);
        return restTemplate.postForObject("http://nacosServerStudy/user/list", entity,String.class);
    }

    @RequestMapping("test1")
    public JsonResult test1(){
        DictUsersDto dto = new DictUsersDto();
        JsonResult jsonResult= dictUserFeignClient.getDictUsersAll(dto);
        return jsonResult;
    }
}
